package com.mkz.config.feign;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.mkz.config.convertor.MapConvertor;
import com.mkz.config.feign.ParamClient;

import cn.hutool.core.collection.CollectionUtil;

/**
 * ClassName: ParamController 
 * @Description: 获取系统参数值
 * @author: KuangJianyu
 * @date: 2020年4月18日
 */
@RestController
public class IParamClient implements ParamClient {
	@Autowired
	private MapConvertor mapConvertor;
	
	@PutMapping("/get")
	public String get(@RequestParam String key) {
		Map<String, String> globalMap = mapConvertor.getGlobal();
		if(CollectionUtil.isEmpty(globalMap)) {
			return "";
		}
		return globalMap.get(key);
	}
}
